/**
 * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation; either version 2.1 of the License, or (at your option)
 * any later version.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 */

package doan.quanlycanbo.portlet.model.impl;

import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
import com.liferay.portal.kernel.util.GetterUtil;
import com.liferay.portal.kernel.util.StringBundler;
import com.liferay.portal.kernel.util.StringPool;
import com.liferay.portal.model.impl.BaseModelImpl;
import com.liferay.portal.service.ServiceContext;

import com.liferay.portlet.expando.model.ExpandoBridge;
import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;

import doan.quanlycanbo.portlet.model.tongiao;
import doan.quanlycanbo.portlet.model.tongiaoModel;

import java.io.Serializable;

import java.lang.reflect.Proxy;

import java.sql.Types;

/**
 * The base model implementation for the tongiao service. Represents a row in the &quot;tongiao&quot; database table, with each column mapped to a property of this class.
 *
 * <p>
 * This implementation and its corresponding interface {@link doan.quanlycanbo.portlet.model.tongiaoModel} exist only as a container for the default property accessors generated by ServiceBuilder. Helper methods and all application logic should be put in {@link tongiaoImpl}.
 * </p>
 *
 * <p>
 * Never modify or reference this class directly. All methods that expect a tongiao model instance should use the {@link doan.quanlycanbo.portlet.model.tongiao} interface instead.
 * </p>
 *
 * @author Nguyen Tuan Vinh
 * @see tongiaoImpl
 * @see doan.quanlycanbo.portlet.model.tongiao
 * @see doan.quanlycanbo.portlet.model.tongiaoModel
 * @generated
 */
public class tongiaoModelImpl extends BaseModelImpl<tongiao>
	implements tongiaoModel {
	public static final String TABLE_NAME = "tongiao";
	public static final Object[][] TABLE_COLUMNS = {
			{ "matongiao", new Integer(Types.BIGINT) },
			{ "groupId", new Integer(Types.BIGINT) },
			{ "companyId", new Integer(Types.BIGINT) },
			{ "languageId", new Integer(Types.VARCHAR) },
			{ "tentongiao", new Integer(Types.VARCHAR) }
		};
	public static final String TABLE_SQL_CREATE = "create table tongiao (matongiao LONG not null primary key,groupId LONG,companyId LONG,languageId VARCHAR(75) null,tentongiao VARCHAR(75) null)";
	public static final String TABLE_SQL_DROP = "drop table tongiao";
	public static final String ORDER_BY_JPQL = " ORDER BY tongiao.tentongiao DESC";
	public static final String ORDER_BY_SQL = " ORDER BY tongiao.tentongiao DESC";
	public static final String DATA_SOURCE = "liferayDataSource";
	public static final String SESSION_FACTORY = "liferaySessionFactory";
	public static final String TX_MANAGER = "liferayTransactionManager";
	public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get(
				"value.object.entity.cache.enabled.doan.quanlycanbo.portlet.model.tongiao"),
			true);
	public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get(
				"value.object.finder.cache.enabled.doan.quanlycanbo.portlet.model.tongiao"),
			true);
	public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.util.service.ServiceProps.get(
				"lock.expiration.time.doan.quanlycanbo.portlet.model.tongiao"));

	public tongiaoModelImpl() {
	}

	public long getPrimaryKey() {
		return _matongiao;
	}

	public void setPrimaryKey(long pk) {
		setMatongiao(pk);
	}

	public Serializable getPrimaryKeyObj() {
		return new Long(_matongiao);
	}

	public long getMatongiao() {
		return _matongiao;
	}

	public void setMatongiao(long matongiao) {
		_matongiao = matongiao;
	}

	public long getGroupId() {
		return _groupId;
	}

	public void setGroupId(long groupId) {
		_groupId = groupId;
	}

	public long getCompanyId() {
		return _companyId;
	}

	public void setCompanyId(long companyId) {
		_companyId = companyId;
	}

	public String getLanguageId() {
		if (_languageId == null) {
			return StringPool.BLANK;
		}
		else {
			return _languageId;
		}
	}

	public void setLanguageId(String languageId) {
		_languageId = languageId;
	}

	public String getTentongiao() {
		if (_tentongiao == null) {
			return StringPool.BLANK;
		}
		else {
			return _tentongiao;
		}
	}

	public void setTentongiao(String tentongiao) {
		_tentongiao = tentongiao;
	}

	public tongiao toEscapedModel() {
		if (isEscapedModel()) {
			return (tongiao)this;
		}
		else {
			return (tongiao)Proxy.newProxyInstance(tongiao.class.getClassLoader(),
				new Class[] { tongiao.class }, new AutoEscapeBeanHandler(this));
		}
	}

	public ExpandoBridge getExpandoBridge() {
		if (_expandoBridge == null) {
			_expandoBridge = ExpandoBridgeFactoryUtil.getExpandoBridge(getCompanyId(),
					tongiao.class.getName(), getPrimaryKey());
		}

		return _expandoBridge;
	}

	public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
		getExpandoBridge().setAttributes(serviceContext);
	}

	public Object clone() {
		tongiaoImpl tongiaoImpl = new tongiaoImpl();

		tongiaoImpl.setMatongiao(getMatongiao());

		tongiaoImpl.setGroupId(getGroupId());

		tongiaoImpl.setCompanyId(getCompanyId());

		tongiaoImpl.setLanguageId(getLanguageId());

		tongiaoImpl.setTentongiao(getTentongiao());

		return tongiaoImpl;
	}

	public int compareTo(tongiao tongiao) {
		int value = 0;

		value = getTentongiao().compareTo(tongiao.getTentongiao());

		value = value * -1;

		if (value != 0) {
			return value;
		}

		return 0;
	}

	public boolean equals(Object obj) {
		if (obj == null) {
			return false;
		}

		tongiao tongiao = null;

		try {
			tongiao = (tongiao)obj;
		}
		catch (ClassCastException cce) {
			return false;
		}

		long pk = tongiao.getPrimaryKey();

		if (getPrimaryKey() == pk) {
			return true;
		}
		else {
			return false;
		}
	}

	public int hashCode() {
		return (int)getPrimaryKey();
	}

	public String toString() {
		StringBundler sb = new StringBundler(11);

		sb.append("{matongiao=");
		sb.append(getMatongiao());
		sb.append(", groupId=");
		sb.append(getGroupId());
		sb.append(", companyId=");
		sb.append(getCompanyId());
		sb.append(", languageId=");
		sb.append(getLanguageId());
		sb.append(", tentongiao=");
		sb.append(getTentongiao());
		sb.append("}");

		return sb.toString();
	}

	public String toXmlString() {
		StringBundler sb = new StringBundler(19);

		sb.append("<model><model-name>");
		sb.append("doan.quanlycanbo.portlet.model.tongiao");
		sb.append("</model-name>");

		sb.append(
			"<column><column-name>matongiao</column-name><column-value><![CDATA[");
		sb.append(getMatongiao());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>groupId</column-name><column-value><![CDATA[");
		sb.append(getGroupId());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>companyId</column-name><column-value><![CDATA[");
		sb.append(getCompanyId());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>languageId</column-name><column-value><![CDATA[");
		sb.append(getLanguageId());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>tentongiao</column-name><column-value><![CDATA[");
		sb.append(getTentongiao());
		sb.append("]]></column-value></column>");

		sb.append("</model>");

		return sb.toString();
	}

	private long _matongiao;
	private long _groupId;
	private long _companyId;
	private String _languageId;
	private String _tentongiao;
	private transient ExpandoBridge _expandoBridge;
}